package com.umeox.watch.worshiplearn.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.NonNull
import androidx.recyclerview.widget.RecyclerView
import com.umeox.moto.watch.themes.widget.ImageView
import com.umeox.watch.worshiplearn.R
import java.util.*

/**
 * Created by Rambo 2022/9/10
 * Describe:
 */
class ViewPagerAdapter(private val data: List<Int>,private  val resLayout:Int) :
    RecyclerView.Adapter<ViewPagerAdapter.ViewPagerHolder?>() {

    override fun onCreateViewHolder(
        parent: ViewGroup,
        viewType: Int
    ): ViewPagerAdapter.ViewPagerHolder {
                return ViewPagerHolder(
            LayoutInflater.from(parent.context).inflate(resLayout, parent, false)
        )
    }

    override fun onBindViewHolder(holder: ViewPagerAdapter.ViewPagerHolder, position: Int) {
        holder.mImageView.setImageResource(data[position])
    }

    override fun getItemCount(): Int {
        return data.size
    }


    inner class ViewPagerHolder(itemView: View) :
        RecyclerView.ViewHolder(itemView) {
        var mImageView: ImageView

        init {
            mImageView = itemView.findViewById(R.id.iv)
        }
    }
}
